<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title><?php echo ($title); ?></title>
    <link rel="stylesheet" href="/Public/web/css/pintuer.css">
    <link rel="stylesheet" href="/Public/web/css/admin.css">
    <script src="/Public/web/js/jquery.js"></script>
    <script src="/Public/web/js/pintuer.js"></script>
</head>

<style type="text/css">
	.nonetips{text-align: left; border-bottom: solid 1px #ddd; padding-bottom: 10px; color: red}
</style>

<body>
	<div class="panel admin-panel">
		<div class="panel-head"><strong class="icon-reorder"> 管理小程序</strong></div>
		<div class="padding border-bottom"></div>
		<table class="table table-hover text-center">
			<tr><th colspan="4" style="background: #f9f9f9; text-align: left">发布中的小程序</th></tr>
			<tr>
				<th width="15%">更新时间</th>
				<th width="50%">状态</th>
				<th width="15%">操作</th>
			</tr>
			<?php if(empty($list_fb)): ?><tr><td colspan="4">
					<div class="nonetips">暂无发布中的小程序，请先上传审核小程序</div>
				</td></tr><?php endif; ?>
			<?php if(is_array($list_fb)): foreach($list_fb as $key=>$v): ?><tr style="border-bottom: solid 1px #ddd;">
					<td><?php echo (date('Y-m-d H:i:s',$v['add_time'])); ?></td>
					<td style="color: blue"><?php if($v['show'] == 0): ?>已发布，可在微信小程序中搜索<?php endif; ?></td>
					<td>
						<div class="button-group">
							<a class="button border-main" href="<?php echo U('Accredit/manager_add',array('id'=>$v['id']));?>"><span class="icon-edit"></span> 编辑</a>
							<a class="button border-red" href="<?php echo U('Accredit/manager_sh',array('id'=>$v['id']));?>" onclick="return sh()"><span class="icon-trash-o"></span> 重新上传</a>
						</div>
					</td>
				</tr><?php endforeach; endif; ?>
		</table>

		<table class="table table-hover text-center" style="margin-top: 20px; border-top: solid 1px #ddd;">
			<tr><th colspan="4" style="background: #f9f9f9; text-align: left">审核中的小程序</th></tr>
			<tr>
				<th width="15%">更新时间</th>
				<th width="20%">体验二维码</th>
				<th width="50%">状态</th>
				<th width="15%">操作</th>
			</tr>
			<?php if(empty($list_sh)): ?><tr><td colspan="4">
					<div class="nonetips">暂无发布中的小程序，请先上传提交审核小程序</div>
				</td></tr><?php endif; ?>
			<?php if(is_array($list_sh)): foreach($list_sh as $key=>$a): ?><tr style="border-bottom: solid 1px #ddd;">
					<td><?php echo (date('Y-m-d H:i:s',$a['add_time'])); ?></td>
					<td><img src="<?php echo ($a['mypic']); ?>" width="100px"></td>
					<td><?php echo ($a['reason']); ?></td>
					<td>
						<div class="button-group">
							<?php if($a['reason'] == '可发布'): ?><a class="button border-main" href="<?php echo U('Accredit/manager_fb',array('id'=>$a['id']));?>" onclick="return sh()"><span class="icon-edit"></span> 发布</a><?php endif; ?>
							<?php if($a['status'] == 1): ?><a class="button border-main" href="<?php echo U('Accredit/manager_add',array('id'=>$a['id']));?>"><span class="icon-edit"></span> 编辑</a>
								<a class="button border-red" href="<?php echo U('Accredit/manager_sh',array('id'=>$a['id']));?>" onclick="return sh()"><span class="icon-trash-o"></span> 重新上传</a>
							<?php else: ?>
								<font color="red">待审核结束后才可进行修改</font><?php endif; ?>
						</div>
					</td>
				</tr><?php endforeach; endif; ?>
		</table>

		<table class="table table-hover text-center" style="margin-top: 20px; border-top: solid 1px #ddd;">
			<tr><th colspan="4" style="background: #f9f9f9; text-align: left">上传中的小程序</th></tr>
			<tr>
				<th width="15%">更新时间</th>
				<th width="20%">体验二维码</th>
				<th width="50%">状态</th>
				<th width="15%">操作</th>
			</tr>
			<tr class="list_sc" style="<?php if(empty($list_sc)): ?>display: table-row<?php else: ?>display: none<?php endif; ?>"><td colspan="4" style="color: red" align="left">
				暂无上传中小程序　
				<?php if(!$list_fb and !$list_sh and !$list_sc): ?><a class="button border-main icon-plus-square-o" href="<?php echo U('Accredit/manager_add');?>"> 上传小程序</a><?php endif; ?>
			</td></tr>
			<?php if(is_array($list_sc)): foreach($list_sc as $key=>$l): ?><tr class="tr<?php echo ($l['id']); ?>">
					<td><?php echo (date('Y-m-d H:i:s',$l['add_time'])); ?></td>
					<td><?php if($l['state'] == 0): ?><img src="<?php echo ($l['mypic']); ?>" width="100px"><?php endif; ?></td>
					<td>待上传</td>
					<td>
						<div class="button-group">
							<a class="button border-main" href="<?php echo U('Accredit/manager_sh',array('id'=>$l['id']));?>" onclick="return sh()"><span class="icon-edit"></span> 上传审核</a>
							<a class="button border-main" href="<?php echo U('Accredit/manager_add',array('id'=>$l['id']));?>"><span class="icon-edit"></span> 编辑</a>
							<a class="button border-red" href="javascript:void(0)" onclick="return del(<?php echo ($l['id']); ?>)"><span class="icon-trash-o"></span> 删除</a>
						</div>
					</td>
				</tr><?php endforeach; endif; ?>
		</table>
	</div>
</body>
<script type="text/javascript">
	function del(id){
		if(confirm("确认删除吗？")){
			var url = "<?php echo U('Accredit/manager_del');?>";
			$.getJSON(url,{id:id},function (data){
				if(data.result == 'yes'){$(".tr"+id).remove();$(".list_sc").show();}
				else{alert('参数错误');}
			})
		}
	}
	function sh(){
		if(confirm("确认要上传审核吗？")){
			return true;
		}else{
			return false;
		}
	}
</script>

</html>